home *** CD-ROM | disk | FTP | other *** search
- Path: cs.usm.my!not-for-mail
- From: bahari@cs.usm.my (Bahari Belaton (Dr))
- Newsgroups: comp.lang.c
- Subject: Question on pointer-to-pointer-to-pointer-...
- Date: 20 Jan 1996 06:34:59 GMT
- Organization: School of Computer Science, USM.
- Message-ID: <4dq2ej$m3t@cssun.cs.usm.my>
- NNTP-Posting-Host: cssun.cs.usm.my
- X-Newsreader: TIN [UNIX 1.3 950824BETA - USM Penang PL0]
-
- Hi,
- Below is one of the question asked by my student about pointer-to-pointer in
- C - with a specific example on strtod() function. Can anyone help me explain
- this to my student. Especially on the important of pointer-to-pointer.
-
- Thanks
-
- Bahari Belaton
-
- =======================================================================
- Dear All,
- I hope you can enlighthen me a bit.
- Query 1:
- According to Deitel, the function prototype for strtod() is:-
- double strtod(const char *nPtr, char **endPtr) and the function call is
- as follows :-
- double d;
- char *string = "51.2% are admitted";
- char *stringPtr;
-
- d = strtod(string, &stringPtr);
-
- The book says that &stringPtr is assigned the location of the first character
- after the converted value. How does the function do that?
-
- I'm still confused with **endPtr. Why the **endPtr(pointer to a
- pointer) is used?(What is the significance of using a double pointer? Why
- not just *endPtr since the function assigned the address of first
- character of the string to &stringPtr. (what about***endPtr?
- How many pointers to pointer can we used?)
-
- Thank you very much.
- Your student,
- LEE KENG TUNG csi36864@wira2.cs.usm.my
-
- =================================
-